package com.ctl.jvm;

import com.ctl.jvm.model.Person;
import java.util.LinkedHashSet;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;

public class Test {
//    static  LinkedHashSet<Person> linkedHashSet = new LinkedHashSet();
    static Set<Person> linkedHashSet = new ConcurrentSkipListSet();

    public static void main(String[] args) {
        for (int i = 0; i <5 ; i++) {
            linkedHashSet.add(new Person("ctl_"+i,new Random().nextInt(100)));
        }
        for (int i = 30; i <35 ; i++) {
            linkedHashSet.add(new Person("ctl_"+i,new Random().nextInt(100)));
        }
        System.out.println(linkedHashSet);
        linkedHashSet.add(new Person("ctl_"+12,new Random().nextInt(100)));
        System.out.println(linkedHashSet);
        linkedHashSet.clear();

        for (int i = 0; i <5 ; i++) {
            linkedHashSet.add(new Person("ctl_"+i,new Random().nextInt(100)));
        }

        for (int i = 30; i <35 ; i++) {
            linkedHashSet.add(new Person("ctl_"+i,new Random().nextInt(100)));
        }
        linkedHashSet.add(new Person("ctl_"+12,new Random().nextInt(100)));

        System.out.println(linkedHashSet);
    }
}
